//
//  QuestionAnswerDetailCell.m
//  HappyMother
//
//  Created by 易东 on 2017/10/26.
//  Copyright © 2017年 东哥. All rights reserved.
//

#import "QuestionAnswerDetailCell.h"
#import "UIView+SDAutoLayout.h"
#import "PhotosContainerView.h"
#import "QuestionAnswerDetailModel.h"


@implementation QuestionAnswerDetailCell
{
    PhotosContainerView *_photosContainer;
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    //最多6张图片
    PhotosContainerView *photosContainer = [[PhotosContainerView alloc] initWithMaxItemsCount:6];
    
    _photosContainer = photosContainer;
    
    [self.contentView addSubview:photosContainer];
    

    self.contentlbl.sd_layout.leftSpaceToView(self.contentView,20).rightSpaceToView(self.contentView,10).topSpaceToView(_dayslbl,10).autoHeightRatio(0);
    
    _photosContainer.sd_layout
    .leftSpaceToView(self.contentView, 20)
    .topSpaceToView(_contentlbl,10)
    .rightSpaceToView(self.contentView, 10)
    .autoHeightRatio(0);
    
    
    
}
-(void)setModel:(QuestionAnswerDetailModel *)model{
  
    _model = model;
    
    _contentlbl.text = model.content;
    
    UIView *bottomView = _photosContainer;
    
    
    _photosContainer.photoNamesArray = model.imagePathsArray;
    
    if (model.imagePathsArray.count==0) {
        
        bottomView = _contentlbl;
        _photosContainer.hidden = 1;
        
    }else{
        _photosContainer.hidden = 0;
    }
    
    [self setupAutoHeightWithBottomView:bottomView bottomMargin:40];
}

@end
